﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 课程排班管理 <span class="c-gray en">&gt;</span> 课程排班列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
			<a class="btn btn-success radius" onclick="add_again('添加课程','{:url('add_again')}?course_id='+{$course_id})">
				<i class="Hui-iconfont">&#xe600;</i> 添加课程
			</a>
		</span>
		<span class="r">共有：<strong>{$total}</strong> 条</span>
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-sort">
			<thead>
			<tr class="text-c">
				<th width="60">星期</th>
				<th width="250">时段</th>
				<th width="250">课程名称</th>
				<th width="200">班级名称</th>
				<th width="100">选择教师</th>
				<th width="200">操作</th>
			</tr>
			</thead>
			<tbody id="arrangeList">
			{foreach name="new_list" item="val" key="key"}
			<tr class="text-c">
				<td>{$val['week_day']}</td>
				<td>{$val['time']}</td>
				<td>{$val['course_name']}</td>
				<td>{$val['class_name']}</td>
				<td>{$val['teacher_name']}</td>
				<td class="f-14 product-brand-manage" id="use">

					<a class="label label-secondary radius" href="{:url('edit',['course_time_id'=>$val.course_time_id, 'course_id'=>$course_id ])}">点击编辑</a>

					{if $val['is_del'] == 0}
						<span class="label label-success radius" onClick="is_arrange('{$val.course_time_id}',1,'{$val.course_id}')" >点击关闭</span>
					{else /}
						<span class="label label-danger radius"  onClick="is_arrange('{$val.course_time_id}',0,'{$val.course_id}')">点击开启</span>
					{/if}
				</td>
			</tr>
			{/foreach}
			{if count($new_list)<=0 }
			<tr class="text-c">
				<td colspan="6">
					暂无数据
				</td>
			</tr>
			{/if}
			</tbody>
		</table>
	</div>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-5 col-sm-offset-5" style="margin-top: 100px;">
			<a class="btn btn-warning radius" href="{:url('course/index')}">&nbsp;&nbsp;返回&nbsp;&nbsp;</a>
		</div>
	</div>
	{$page}
</div>

{include file="public:footer_js"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">

    //排课状态
    function is_arrange(course_time_id,status,course_id) {
        var notice = "确定关闭吗？";
        if (status == 1){
            notice = "确定关闭吗？";
        }else if(status == 0){
            notice = "确定开启吗？";
        }
        //异步提交
        layer.confirm(notice,function (index) {
            $.ajax({
                type:"POST",
                url:"{:url('is_arrange')}",
                data:{
                    course_time_id     : course_time_id,
                    is_del             : status,
                    course_id          : course_id,
                },
                async:true,
                success:function (res) {
                    if(res.code === 0){
                        layer.msg(res.msg,{icon:5,time:2000});
                    }else{
                        layer.msg(res.msg,{icon:6,time:2000});
                        setTimeout(
                            function(){
                                location.href = "{:url('course_arrange/index')}"+"?course_id="+res.data;
                            },
                            2000);
                    }
                }
            });

        })
    }
	//再次添加课程
    function add_again(title,url,w,h){
        layer_show(title,url,500,500);
	}
</script>
</body>
</html>